{# empty Twig template #}
<div class="rowElem">
<label>Find by Country <span class="req">*</span></label>
<div class="formRight">
{%if geography is empty %}
<input name="geoparent1" type="hidden" value="N">
Result not found 
{% elseif geography==0%}
parent doesn't exist in this level
<input name="geoparent1" type="hidden" value="0">
{% else %}
<select name="geoparent1" id="geoparent1">
    <option value="N">Select parent</option>
    {% for geo in geography %}
    <option value="{{geo.id}}">{{geo.name}}</option>
    {% endfor%}
</select>
{% endif%}
</div>
<div class="fix"></div>
</div> 
	

<script>
$('#geoparent1').on('change', function() {
 
 var data=parseInt(this.value);
 var action='{{ path('em_geography_levelParent',{'parent':'data'}) }}';   
 action=action.replace("data",data);
 console.log(action); 
 if(data!==-1)
 {
 $.ajax({type: 'POST', url:action, script:true, cache:false,data: data,
                    beforeSend: function(response){ $('#combo2').html('<div align="center"><img src="{{asset('bundles/news/images/loaders/loader.gif')}}" alt="" class="p12"><br>Loading data...</div>');},
                    error: function(response){console.log(response);},
                    success: function(response) {
			if (response === "false"){

			}else{
                       // console.log(response);
                        $('#combo2').html(response);
                        
			}
                } });
 }
 else
 {
 $('#combo').html("");
 }
});
</script>
